/**
 *Author: Jiangtao He; Email: ross.jiangtao.he@gmail.com
 *File Name: HttpProcess.java
 *Date: 2012-1-18
 *Copyright: All right reserved by author - Jiangtao He
 *Version: MyJavaExpert v1.0
 */
package com.ross.httpdownload.util;

import java.io.IOException;
import java.net.*;

/**
 * Author: Jiangtao He; Email: ross.jiangtao.he@gmail.com
 * Date: 2012-1-18
 * Since: MyJavaExpert v1.0
 * Description: This class will provide the common process of http
 */
public class HttpProcess
{
    /**
     * Author: Jiangtao He; Email: ross.jiangtao.he@gmail.com
     * Description: get an object of opened URL connection
     * @param sURL: completed URL string
     * @return oHttpURLCon: an object of opened URL connection
     * @throws IOException
     */
    public URLConnection  getURLConnection(String sURL) throws IOException
    {
        URLConnection  oURLCon = null;
        // replace space with '+' in the URL string
        if (null != sURL)
        {
            sURL = sURL.replaceAll("\\s", "+");
            // generate URL
            URL oURL = new URL(sURL);
            oURLCon = (URLConnection) oURL.openConnection();
        }
        return oURLCon;
    }

}
